<template>
  <div class="app-container">
    <el-table :data="freightorder">
      <el-table-column label="货运单编号" align="center" prop="code"/>
      <el-table-column label="采收工厂" align="center" prop="csgc"/>
      <el-table-column label="客户名称" align="center" prop="customername"/>
      <el-table-column label="采收日期" align="center" prop="createtime"/>
      <el-table-column label="品种" align="center" prop="variety"/>
      <el-table-column label="规格" align="center" prop="specification"/>
      <el-table-column label="结算重量(吨)" align="center" prop="settleWeight"/>
      <el-table-column label="单价" align="center" prop="price"/>
      <el-table-column label="扣杂(%)" align="center" prop="deductRate"/>
      <el-table-column label="结算金额(元)" align="center" prop="settleAmount"/>
      <el-table-column label="订单状态" align="center" prop="orderstatus"/>
      <el-table-column label="支付状态" align="center" prop="paystatusname"/>
      <el-table-column label="入库库房" align="center" prop="storeroomname"/>
      <el-table-column label="入库日期" align="center" prop="rcdate"/>
    </el-table>
  </div>
</template>

<script>
  import request from "@/utils/request";

  export default {
    name: 'Payinfoforders',
    props: ['id'],
    data() {
      return {
        guid: this.id,
        organizations: [],
        currentPage: 1,
        totalPage: 0,
        searchName: '',
        batchs: [],
        batchGuid: '',
        freightorder: []
      }
    },
    mounted() {
      let that = this;
      that.getPageData();
    },
    methods: {
      search: function () {
        this.getPageData('search');
      },
      turnPage: function (data) {
        this.currentPage = data;
        this.getPageData();
      },
      getPageData: function (type = '') {
        let that = this;
        let postData = {};
        postData.payinfoguid = that.$route.query.id;
        request({
          url: '/harvest/freightorder/getFreightorder/' + that.$route.query.id,
          type: "get"
        }).then(response => {
          this.freightorder = response.rows;
        });;
      },
      exportAccept: function (guid) {

        window.location.href = "/pay/Payinfo!printAcceptForm.action?orderid=" + guid;
      },
      exportQaform: function (guid) {

        window.location.href = "/pay/Payinfo!printQAForm.action?orderid" + guid;
      },
      /**
       * 查询权限内所有选项的数据
       * @param guid  选择框内选项
       * @param entitys 选择框内所有枚举值
       */
      selectPermisAll: function (guid, entitys, description) {
        if (entitys.length == 0) {
          this.toast(description);
          return false;
        }
        if (guid != '') {
          return false;
        }
        var srguids = [];
        $.each(entitys, function (index, entity) {
          srguids.push(entity.guid)
        });
        return srguids.toString();
      },
      getTypeName: function (type) {

        let name = '';
        switch (type) {
          case '1':
            name = '采收入库';
            break;
          case '2':
            name = '地头直销';
            break;

        }
        return name;
      },
    },
  }
</script>
